package cn.ronghui.project.test;

import cn.ronghui.project.domain.application.model.entity.ApplicationCreateEntity;
import cn.ronghui.project.domain.application.model.entity.ApplicationResultEntity;
import cn.ronghui.project.domain.application.service.IApplicationService;
import cn.ronghui.project.domain.student.model.entity.StudentEntity;
import cn.ronghui.project.domain.student.service.IStudentService;
import cn.ronghui.project.infrastructure.dao.IStudentDao;
import cn.ronghui.project.infrastructure.dao.po.Student;
import cn.ronghui.project.types.enums.RoomTypeEnumVO;
import lombok.extern.slf4j.Slf4j;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringRunner;

import javax.annotation.RegEx;
import javax.annotation.Resource;
import java.time.LocalDate;
import java.util.List;

@Slf4j
@RunWith(SpringRunner.class)
@SpringBootTest
public class ApiTest {

    @Resource
    private IStudentService studentService;

    @Resource
    private IStudentDao studentDao;

    @Resource
    private IApplicationService applicationService;

    @Test
    public void test() {
//        StudentEntity studentEntity = studentService.queryStudentInfo("20230001");
        List<Student> students = studentDao.queryStudentList();
//        log.info("student:{}",studentEntity);
//        log.info(students.toString());
        for (Student student : students) {
            log.info(student.toString());
        }
        log.info("测试完成");
    }

    @Test
    public void test_application() {
        ApplicationResultEntity applicationResultEntity = applicationService.createApplication(ApplicationCreateEntity.builder()
                        .applicationId(null)
                .studentId("20230001")
                .roomType(RoomTypeEnumVO.SINGLE)
                .startDate(LocalDate.of(2023, 9, 1))
                .endDate(LocalDate.of(2023, 12, 1))
                .build());
        log.info("applicationResultEntity:{}",applicationResultEntity);
    }

}
